﻿using PropertyChanged;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace VIA.SiMoJi.Domain.Option
{
    [AddINotifyPropertyChangedInterface]
    public class InspectorOption
    {
        public bool IsVirtualMode { get; set; }
        /// <summary>
        /// 屏蔽安全门
        /// </summary>
        public bool IsIgnoreSaveDoor { get; set; }
        /// <summary>
        /// 空跑模式
        /// </summary>
        public bool IsDryRunMode { get; set; }
        /// <summary>
        /// 关闭蜂鸣器
        /// </summary>
        public bool IsCloseBuzzer { get; set; }
        ///// <summary>
        ///// 气缸报警延时
        ///// </summary>
        //public int CylinderTimeout { get; set; } = 3000;
        ///// <summary>
        ///// 轴报警延时
        ///// </summary>
        //public int AxisTimeout { get; set; } = 15_000;
        ///// <summary>
        ///// 等待气缸到位延时
        ///// </summary>
        //public int WaitCylinder { get; set; } = 1000;
        ///// <summary>
        ///// 等轴到位延时
        ///// </summary>
        //public int WaitAxis { get; set; } = 2000;
        ///// <summary>
        ///// 真空报警延时
        ///// </summary>
        //public int VaccumTimeout { get; set; } = 3000;
        ///// <summary>
        ///// 信号到位等待延时
        ///// </summary>
        //public int SensorOnDelay { get; set; } = 1000;
        /// <summary>
        /// 真空到位等待延时
        /// </summary>
        //public int VaccumOnDelay { get; set; } = 1000;

        //public bool IsVisionStationShield { get; set; }
        //public bool IsGongLiaoStationShield { get; set; }
        //public bool IsBanYunStationShield { get; set; }
        //public bool IsSiMoStationShield { get; set; }
        //public bool IsFeiDa1StationShield { get; set; }
        //public bool IsFeiDa2StationShield { get; set; }
        /// <summary>
        /// 屏蔽夹爪开闭检测光纤
        /// </summary>
        public bool IsJawOpenCloseGuangXianShield { get; set; }
        /// <summary>
        /// 屏蔽夹检测光纤
        /// </summary>
        public bool IsJawGuangXianShield { get; set; }
        /// <summary>
        /// 飞达单片膜的间距
        /// </summary>
        public double FeedarOneStepDistance { get; set; } = 10;
        /// <summary>
        /// 飞达贴满一组膜的间距
        /// </summary>
        public double FeedarLongStepDistance { get; set; } = 200;
        /// <summary>
        /// 飞达前进步数
        /// </summary>
        public int FeedarSteps { get; set; } = 3;
        /// <summary>
        /// 夹爪间距
        /// </summary>
        public double JawDistance { get; set; } = 40;
        /// <summary>
        /// 撕膜插补速度
        /// </summary>
        public double SiMoSpeed { get; set; } = 30;
        /// <summary>
        /// 整机速度
        /// </summary>
        public double SpeedPersent { get; set; }
        public TimeSpan RunningTimeSpan { get; set; } = TimeSpan.Zero;
        public DataDeleteOption DataDeleteOption { get; set; } = new();
        //public CalibrationOption CalibrationOption { get; set; } = new();
        /// <summary>
        ///飞拍读码NG重试次数
        /// </summary>
        public int FlyReadCodeCount { get; set; } = 3;
        /// <summary>
        /// 是否启用上相机读码
        /// </summary>
        public bool IsUseUpReadBarcode { get; set; } = false;
        /// <summary>
        /// 撕膜1夹爪补偿
        /// </summary>
        public JawOffsetOption JawOffset1 { get; set; } = new JawOffsetOption();
        /// <summary>
        /// 撕膜2夹爪补偿
        /// </summary>
        public JawOffsetOption JawOffset2 { get; set; } = new JawOffsetOption();
        /// <summary>
        /// 吸嘴力距卡控
        /// </summary>
        public LijuToleranceOption LijuTolerance { get; set; } = new LijuToleranceOption();
        /// <summary>
        /// 供料模组动作时间参数
        /// </summary>
        public GongLiaoMotionTimeOption GLMotionTimeOption { get; set; } = new GongLiaoMotionTimeOption();
        /// <summary>
        /// 搬运模组动作时间参数
        /// </summary>
        public BanYunMotionTimeOption BYMotionTimeOption { get; set; } = new BanYunMotionTimeOption();
        /// <summary>
        /// 撕膜模组动作时间参数
        /// </summary>
        public SiMoMotionTimeOption SMMotionTimeOption { get; set; } = new SiMoMotionTimeOption();
        /// <summary>
        /// 自动登出配置
        /// </summary>
        public AutoLogoutOption AutoLogoutOption { get; set;}=new AutoLogoutOption();   
    }

    [AddINotifyPropertyChangedInterface]
    public class JawOffsetOption
    {
        public double Offset1 { get; set; }
        public double Offset2 { get; set; }
        public double Offset3 { get; set; }
        public double Offset4 { get; set; }
        public double Offset5 { get; set; }
        public double Offset6 { get; set; }
        public double Offset7 { get; set; }
    }

    [AddINotifyPropertyChangedInterface]
    public class LijuToleranceOption
    {
        public bool IsUse { get; set; } = false;
        public double UpperLimit { get; set; } = 500;
    }
    /// <summary>
    /// 供料模组动作时间参数
    /// </summary>
    [AddINotifyPropertyChangedInterface]
    public class GongLiaoMotionTimeOption
    {
        /// <summary>
        /// 气缸伸出超时间
        /// </summary>
        public int CylinderPushOutTimeOut { get; set; } = 3000;
        /// <summary>
        /// 气缸缩回超时间
        /// </summary>
        public int CylinderTakeBackTimeOut { get; set; } = 3000;
        /// <summary>
        /// 气缸伸出到位延迟
        /// </summary>
        public int CylinderPushOutDelay { get; set; } = 200;
        /// <summary>
        /// 气缸缩回到位延迟
        /// </summary>
        public int CylinderTakeBackDelay { get; set; } = 200;
        /// <summary>
        /// 入料到位光电感应延迟
        /// </summary>
        public int ArriveSensorDelay { get; set; } = 500;
    }
    /// <summary>
    /// 搬运模组动作时间参数
    /// </summary>
    [AddINotifyPropertyChangedInterface]
    public class BanYunMotionTimeOption
    {
        /// <summary>
        /// 吸真空超时间
        /// </summary>
        public int SuckVacuoTimeOut { get; set; } = 1000;
        /// <summary>
        /// 吸真空到位延迟
        /// </summary>
        public int SuckVacuoDelay { get; set; } = 300;
        /// <summary>
        /// 破真空超时间
        /// </summary>
        public int BrokenVacuoTimeOut { get; set; } = 1000;
        /// <summary>
        /// 破真空到位延迟
        /// </summary>
        public int BrokenVacuoDelay { get; set; } = 300;
    }
    /// <summary>
    /// 撕膜模组动作时间参数
    /// </summary>
    [AddINotifyPropertyChangedInterface]
    public class SiMoMotionTimeOption
    {
        /// <summary>
        /// 气缸伸出到位延迟
        /// </summary>
        public int JiaMoCylinderPushOutDelay { get; set; } = 200;
        /// <summary>
        /// 气缸缩回到位延迟
        /// </summary>
        public int JiaMoCylinderTakeBackDelay { get; set; } = 500;
        /// <summary>
        /// 气缸伸出到位延迟
        /// </summary>
        public int YaMoCylinderPushOutDelay { get; set; } = 100;
        /// <summary>
        /// 气缸缩回到位延迟
        /// </summary>
        public int YaMoCylinderTakeBackDelay { get; set; } = 100;
        /// <summary>
        /// 夹爪开关感应光纤超时间
        /// </summary>
        public int JiaOpenCloeSensorTimeout { get; set; } = 3000;
        /// <summary>
        /// 夹爪夹住感应光纤超时间
        /// </summary>
        public int JiaDoneSensorTimeout { get; set; } = 3000;
    }

    [AddINotifyPropertyChangedInterface]
    public class AutoLogoutOption
    {
        /// <summary>
        /// 管理员
        /// </summary>
        public int ManagerTime { get; set; } = 3;
        /// <summary>
        /// 工程师
        /// </summary>
        public int EngineerTime { get; set; }=3;
        /// <summary>
        /// 操作员
        /// </summary>
        public int OPNTime { get; set; } = 720;
    }
}
